﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Hangjing.Model;
using Hangjing.SQLServerDAL;
using Hangjing.Common;

/// <summary>
/// w修改管理员修改数据状态
/// </summary>
public partial class App_Android_Deliver_readUpademsg : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Clear();

        string orderid = WebUtility.InputText(Request["orderid"]);
        int did = HjNetHelper.GetQueryInt("did", 0);


        Custorder dal = new Custorder();

        string sql = "update custorder set Sender= '10'";
        sql += "where OrderID='" + orderid + "' and deliverid=" + did;

        if (WebUtility.excutesql(sql) > 0)
        {
            Response.Write("{\"orderid\":\"" + orderid + "\",\"state\":\"1\"}");
            DeliverInfo delivermodel = new Deliver().GetModel(did);
            dal.AddOrderRecord(orderid, -1, delivermodel.Name, "配送员 点 变动已知");

        }
        else
        {
            Response.Write("{\"orderid\":\"" + orderid + "\",\"state\":\"0\",\"msg\":\"此订单已经被其他配送员接收了，您不能再操作了\"}");
        }


        Response.End();
    }
}
